<template>
  <div>
    <!--    <Info v-model="drawer" :orderId="orderId" @success="getList"/>-->
    <component :is="component" v-model="drawer" :orderId="orderId" :orderType="orderType" :houseId="houseId" @success="getList"/>
  </div>
</template>

<script>
import dailyRent from '@/views/house/condition/components/info/componets/daily-rent.vue'
import longShortRent from '@/views/house/condition/components/info/componets/long-short-rent.vue'

export default {
  name: 'Info',
  components: {
    dailyRent,
    longShortRent
  },
  props: {
    value: {
      type: Boolean,
      default: false
    },
    orderId: {
      default: ''
    },
    orderType:{
      default: ''
    },
    houseId: {
      default: ''
    }
  },
  data() {
    return {
      component: '',
    }
  },
  computed:{
    drawer: {
      get() {
        return this.value
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  watch:{
    value:{
      handler(val) {
        console.log(val)
        if(val){
          this.init()
        }
      },
      immediate: true
    }
  },
  methods: {
    init(){
      console.log('orderType',this.orderType)
      if(this.orderType === '2'){
        this.component = 'dailyRent'
      }else if(this.orderType === '1'){
        this.component = 'longShortRent'
      }
    },
    getList() {
      this.$emit('success')
    }
  }

}
</script>

<style lang="scss" scoped>
</style>
